package hibari.server.mail;

import hibari.client.model.DownloadToken;

public class MailTemplate
{
  protected static String nl;
  public static synchronized MailTemplate create(String lineSeparator)
  {
    nl = lineSeparator;
    MailTemplate result = new MailTemplate();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "You can download our music with link below:" + NL + "<ul>" + NL + "\t<li><a href=\"";
  protected final String TEXT_2 = "\">";
  protected final String TEXT_3 = "</a></li>" + NL + "</ul>" + NL + "This link will be valid till 3 times, after that you can't use this link anymore. If you could not download file, then" + NL + "please contact us, We'll send new download link.";

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
     
DownloadToken token = (DownloadToken) argument;

    stringBuffer.append(TEXT_1);
    stringBuffer.append(token.getDownloadURL());
    stringBuffer.append(TEXT_2);
    stringBuffer.append(token.getDownloadURL());
    stringBuffer.append(TEXT_3);
    return stringBuffer.toString();
  }
}
